import http from './request'
/**************************培训规划和方式******************************** */
//删除培训规划
export const deletePlan = (id) => {
    return http({
        url: `/hongyun-training/plan/deletePlan/${id}`,
        method: 'DELETE',
    })
}
//获取培训列表数据
export const getPlanList = (data) => {
    return http({
        url: '/hongyun-training/plan/getPlanList',
        method: 'POST',
        data
    })
}
//新增/修改培训 规划
export const operatePlan = (data) => {
    return http({
        url: '/hongyun-training/plan/operatePlan',
        method: 'POST',
        data
    })
}
//获取所有培训主题下拉菜单
export const getPlans = () => {
    return http({
        url: '/hongyun-training/plan/getPlans',
        method: 'GET',
    })
}

//培训计划下拉数据
export const getProgramList = (year) => {
    return http({
        url: '/hongyun-training/program/getProgramList?year='+year,
        method: 'GET',
    })
}
//培训课程下拉数据
export const getCourseList = () => {
    return http({
        url: '/hongyun-training/traCourse/getCourseList',
        method: 'GET',
    })
}
/**************************培训课程******************************** */
// 课程列表数据获取
export const findCourse = (data) => {
    return http({
        url: '/hongyun-training/course/findCourse',
        method: 'POST',
        data
    })
}
// 删除培训课程
export const deleteCourse = (id) => {
    return http({
        url: `/hongyun-training/course/deleteCourse/${id}`,
        method: 'DELETE',
    })
}
/**************************培训课程******************************** */
// 课程列表数据获取
export const getCoursePage = (data) => {
    return http({
        url: '/hongyun-training/traCourse/getCoursePage',
        method: 'POST',
        data
    })
}
// 删除培训课程
export const delCourse = (id) => {
    return http({
        url: `/hongyun-training/traCourse/delCourse/${id}`,
        method: 'DELETE',
    })
}
//新建或者编辑时保存数据
export const traCourseoperateCourse = (data) => {
    return http({
        url: '/hongyun-training/traCourse/operateCourse',
        method: 'POST',
        data
    })
}
//详情
export const traCoursegetCourseInfo = (id) => {
    return http({
        url: '/hongyun-training/traCourse/getCourseInfo?id='+id,
        method: 'GET',
    })
}
/**************************培训计划******************************** */
// 课程列表数据获取
export const getProgramPage = (data) => {
    return http({
        url: '/hongyun-training/program/getProgramPage',
        method: 'POST',
        data
    })
}
// 删除培训课程
export const delProgram = (id) => {
    return http({
        url: `/hongyun-training/program/delProgram/${id}`,
        method: 'DELETE',
    })
}
//新建或者编辑时保存数据
export const operateProgram = (data) => {
    return http({
        url: '/hongyun-training/program/operateProgram',
        method: 'POST',
        data
    })
}
//详情
export const getProgramInfo = (id) => {
    return http({
        url: '/hongyun-training/program/getProgramInfo?id='+id,
        method: 'GET',
    })
}

//新建或者编辑时保存数据
export const operateCourse = (data) => {
    return http({
        url: '/hongyun-training/course/operateCourse',
        method: 'POST',
        data
    })
}
//文件上传后获取对应的url
export const uploadCourse = (data) => {
    return http({
        url: '/hongyun-training/course/uploadCourse',
        headers: {'Content-Type': 'multipart/form-data'},
        method: 'POST',
        data
    })
}
//课程详情
export const getCourseInfo = (id) => {
    return http({
        url: '/hongyun-training/course/getCourseInfo?id='+id,
        method: 'GET',
    })
}
//标记已读
export const setCourseRead = (data) => {
    return http({
        url: '/hongyun-training/course/setCourseRead?courseId='+data.courseId+'&userId='+data.userId,
        method: 'PUT',
    })
}
//已参加
export const setCourseRecord = (obj) => {
    return http({
        url: '/hongyun-training/course/setCourseRecord?courseId='+obj.courseId+'&userId='+obj.userId,
        method: 'PUT',
    })
}
/**************************考试******************************** */
//获取所有的课程
export const getCourses = (data) => {
    return http({
        url: '/hongyun-training/course/getCourses',
        method: 'POST',
        data
    })
}
//获取所有的考试列表
export const findExamineList = (data) => {
    return http({
        url: '/hongyun-training/examine/findExamineList',
        method: 'POST',
        data
    })
}
//新增/修改考核
export const operateExamine = (data) => {
    return http({
        url: '/hongyun-training/examine/operateExamine',
        method: 'POST',
        data
    })
}
//获取课程总题数
export const getQuestionNum = (data) => {
    return http({
        url: '/hongyun-training/examine/getQuestionNum',
        method: 'POST',
        data
    })
}
//开始考试
export const findExamineGrade = (data,username) => {
    return http({
        url: '/hongyun-training/examine/findExamineGrade',
        method: 'POST',
        headers: {'username' : username},
        data
    })
}
//考试明细
export const rankingInfo = (data) => {
    return http({
        url: '/hongyun-training/examine/rankingInfo',
        method: 'POST',
        data
    })
}
/**************************考试题库******************************** */
export const getQuestionList = (data) => {
    return http({
        url: '/hongyun-training/examine/getQuestionList',
        method: 'POST',
        data
    })
}
//编辑考试题目
export const operateQuestion = (data) => {
    return http({
        url: '/hongyun-training/examine/operateQuestion',
        method: 'POST',
        data
    })
}
//随机选取考题
export const extractQuestions = (examineId) => {
    return http({
        url: '/hongyun-training/examine/extractQuestions?examineId='+examineId,
        method: 'GET',
    })
}
//批量删除
export const deleteQuestions = (data) => {
    return http({
        url: '/hongyun-training/examine/deleteQuestions',
        method: 'DELETE',
        data
    })
}
//删除
export const deleteQuestion = (id) => {
    return http({
        url: `/hongyun-training/examine/deleteQuestions/${id}`,
        method: 'DELETE',
    })
}
//批量导入
export const questionAllInto = (data) => {
    return http({
        url: '/hongyun-training/examine/questionAllInto',
        headers: {'Content-Type': 'multipart/form-data'},
        method: 'POST',
        data
    })
}
/**************************分数查看与排名******************************** */
//分数查看
export const ranking = (data) => {
    return http({
        url: '/hongyun-training/examine/ranking',
        method: 'POST',
        data
    })
}
//查看考卷
export const getExtract = (examineId,userId) => {
    return http({
        url: '/hongyun-training/examine/getExtract?examineId='+examineId,
        headers: {'userId' : userId},
        method: 'GET',
    })
}
//积分排名
export const getPoints = (data) => {
    return http({
        url: '/hongyun-training/examine/getPoints',
        method: 'POST',
        data
    })
}
/**************************作业许可与作业过程******************************** */
export const getWorkPermitList = (data,username) => {
    return http({
        url: '/hongyun-training/workpermit/getWorkPermitList',
        method: 'POST',
        headers: {'username' : username},
        data
    })
}
export const deleteWorkPermit = (id) => {
    return http({
        url: `/hongyun-training/workpermit/deleteWorkPermit/${id}`,
        method: 'DELETE',
    })
}
export const getWorkPermitInfo = (workId,username) => {
    return http({
        url: '/hongyun-training/workpermit/getWorkPermitInfo?workId='+workId,
        headers: {'username' : username},
        method: 'GET',
    })
}
export const uploadFile = (data) => {
    return http({
        url: '/hongyun-training/workpermit/uploadFile',
        headers: {'Content-Type': 'multipart/form-data'},
        method: 'POST',
        data
    })
}
//新建作业许可
export const operateWorkPermit = (data,username) => {
    return http({
        url: '/hongyun-training/workpermit/operateWorkPermit',
        method: 'POST',
        headers: {'username' : username},
        data
    })
}
//查看作业申请单位
export const getCompanyList = () => {
    return http({
        url: '/hongyun-training/common/getCompanyList',
        method: 'GET',
    })
}
//查看动火方式
export const getDataDictionaryList = (ids) => {
    return http({
        url: '/hongyun-training/common/getDataDictionaryList?parentId='+ids,
        method: 'GET',
    })
}
//查看作业票
export const getWorkNoList = () => {
    return http({
        url: '/hongyun-training/workpermit/getWorkNoList',
        method: 'GET',
    })
}

//查所有人员
export const getUserList = () => {
    return http({
        url: '/hongyun-user/user/getUserList',
        method: 'GET',
    })
}
//获取审批模板
export const getWorkTemplate = () => {
    return http({
        url: '/hongyun-training/approve/getWorkTemplate',
        method: 'GET',
    })
}
//电子流审批
export const operateApprove = (data,username) => {
    return http({
        url: '/hongyun-training/approve/operateApprove',
        method: 'POST',
        headers: {'username' : username},
        data
    })
}
//作业许可重建
export const writeWorkRebuild = (workId,username) => {
    return http({
        url: '/hongyun-training/workpermit/writeWorkRebuild?workId='+workId,
        headers: {'username' : username},
        method: 'GET',
    })
}
/**********************作业过程************************ */
export const getWorkCourseList = (data,username) => {
    return http({
        url: '/hongyun-training/workpermit/getWorkCourseList',
        method: 'POST',
        headers: {'username' : username},
        data
    })
}
/**********************已归档作业票************************ */
export const getWorkCloseList = (data,username) => {
    return http({
        url: '/hongyun-training/workpermit/getWorkCloseList',
        method: 'POST',
        headers: {'username' : username},
        data
    })
}
/**
 * 查看已归档作业票
 */
 export const getWorkCloseInfo = (id) => {
    return http({
        url: '/hongyun-training/workpermit/getWorkCloseInfo?workId='+id,
        method: 'GET',
    })
}
/**********************配置信息************************ */
export const getWorkConfig = () => {
    return http({
        url: '/hongyun-training/getWorkConfig/getWorkConfig',
        method: 'GET',
    })
}
//编辑
export const fillWorkConfig = (id) => {
    return http({
        url: '/hongyun-training/getWorkConfig/fillWorkConfig?workConfigType='+id,
        method: 'GET',
    })
}
//获取摄像头
export const getVideoList = () => {
    return http({
        url: '/hongyun-training/getWorkConfig/getVideoList',
        method: 'GET',
    })
}
//安全措施提交
export const operateWorkConfig = (data) => {
    return http({
        url: '/hongyun-training/getWorkConfig/operateWorkConfig',
        method: 'POST',
        data
    })
}
//ef安全措施提交
export const operateWorkConfigEF = (data,type) => {
    return http({
        url: '/hongyun-training/getWorkConfig/operateWorkConfigEF?workConfigType='+type,
        method: 'POST',
        data
    })
}
/***************************************************必备物资管理************************************************************* */
//获取列表数据
export const getMaterials = (data) => {
    return http({
        url: '/hongyun-training/material/must/getMaterials',
        method: 'POST',
        data
    })
}
//表单提交
export const operateMaterial = (data) => {
    return http({
        url: '/hongyun-training/material/must/operateMaterial',
        method: 'POST',
        data
    })
}
//删除
export const delMaterial = (id) => {
    return http({
        url: `/hongyun-training/material/must/delMaterial/${id}`,
        method: 'DELETE',
    })
}
//查询物资所属分类
export const getDataByParentCode = (id) => {
    return http({
        url: '/hongyun-training/common/getDataByParentCode?parentCode='+id,
        method: 'GET',
    })
}
/***************************************************必备物资管理新************************************************************* */
//获取列表数据
export const getNecessarymaterialList = (data, current, size) => {
    return http({
        url: `/hongyun-training/necessarymaterial/list?current=${current}&size=${size}`,
        method: 'POST',
        data
    })
}
//表单提交
export const necessarymaterialSubmit = (data) => {
    return http({
        url: '/hongyun-training/necessarymaterial/submit',
        method: 'POST',
        data
    })
}
//删除
export const necessarymaterialRemove = (ids) => {
    return http({
        url: `/hongyun-training/necessarymaterial/remove?ids=${ids}`,
        method: 'POST',
    })
}
/***************************************************现有物资管理************************************************************* */
//获取列表数据
export const existgetMaterials = (data, current, size) => {
    return http({
        url: '/hongyun-training/material/exist/getMaterials?current=' + current + '&size=' + size,
        method: 'POST',
        data
    })
}
//删除
export const existdelMaterial = (id) => {
    return http({
        url: `/hongyun-training/material/exist/delMaterial/${id}`,
        method: 'DELETE',
    })
}
//表单提交
export const existoperateMaterial = (data) => {
    return http({
        url: '/hongyun-training/material/exist/operateMaterial',
        method: 'POST',
        data
    })
}
//存放地址
export const getAddressList = () => {
    return http({
        url: '/hongyun-training/address/getAddressList',
        method: 'GET',
    })
}
//所属必备物资
export const getMaterialList = () => {
    return http({
        url: '/hongyun-training/material/must/getMaterialList',
        method: 'GET',
    })
}
/***************************************************物资存放地址管理************************************************************* */
//获取列表数据
export const getAddress = (data) => {
    return http({
        url: '/hongyun-training/address/getAddress',
        method: 'POST',
        data
    })
}
//删除
export const delAddress = (id) => {
    return http({
        url: `/hongyun-training/address/delAddress/${id}`,
        method: 'DELETE',
    })
}
//表单提交
export const operateAddress = (data) => {
    return http({
        url: '/hongyun-training/address/operateAddress',
        method: 'POST',
        data
    })
}
/***************************************************应急组织管理************************************************************* */
//获取列表数据
export const getOrganizes = (data) => {
    return http({
        url: '/hongyun-training/organize/getOrganizes',
        method: 'POST',
        data
    })
}
//删除
export const delOrganize = (id) => {
    return http({
        url: `/hongyun-training/organize/delOrganize/${id}`,
        method: 'DELETE',
    })
}
//表单提交
export const operateOrganize = (data) => {
    return http({
        url: '/hongyun-training/organize/operateOrganize',
        method: 'POST',
        data
    })
}
/***************************************************应急预案************************************************************* */
//获取列表数据
export const getSchemes = (data) => {
    return http({
        url: '/hongyun-training/scheme/getSchemes',
        method: 'POST',
        data
    })
}
//删除
export const deleteScheme = (id) => {
    return http({
        url: `/hongyun-training/scheme/deleteScheme/${id}`,
        method: 'DELETE',
    })
}
//表单提交
export const operateScheme = (data) => {
    return http({
        url: '/hongyun-training/scheme/operateScheme',
        method: 'POST',
        data
    })
}
//获取应急预案列表
export const getSchemeListscheme = () => {
    return http({
        url: '/hongyun-training/scheme/getSchemeList',
        method: 'GET',
    })
}
/***************************************************应急救援************************************************************* */
//获取列表数据
export const getRescues = (data) => {
    return http({
        url: '/hongyun-training/rescue/getRescues',
        method: 'POST',
        data
    })
}
//查询救援方案
export const getRescueInfo = (id) => {
    return http({
        url: '/hongyun-training/rescue/getRescueInfo?id='+id,
        method: 'GET',
    })
}
//删除
export const deleteRescue = (id) => {
    return http({
        url: `/hongyun-training/rescue/deleteRescue/${id}`,
        method: 'DELETE',
    })
}
//表单提交
export const operateRescue = (data) => {
    return http({
        url: '/hongyun-training/rescue/operateRescue',
        method: 'POST',
        data
    })
}
// 应急预案列表
export const getSchemeList = () => {
    return http({
        url: '/hongyun-training/scheme/getSchemeList',
        method: 'GET',
    })
}
// 应急组织列表
export const getOrganizeList = () => {
    return http({
        url: '/hongyun-training/organize/getOrganizeList',
        method: 'GET',
    })
}

/*****************************隐患上报 *********************************************************/
//整改获取列表数据
export const getReport = (data) => {
    return http({
        url: '/hongyun-training/hazardReport/list',
        method: 'POST',
        data
    })
}
//整改表单提交
export const insertReport = (data) => {
    return http({
        url: '/hongyun-training/hazardReport/insert',
        method: 'POST',
        data
    })
}
export const editReport = (data) => {
    return http({
        url: '/hongyun-training/hazardReport/update',
        method: 'POST',
        data
    })
}
//删除整改信息
export const delReport = (data) => {
    return http({
        url: `/hongyun-training/hazardReport/delete`,
        method: 'DELETE',
        data
    })
}
//删除整改信息
export const delReportById = (id) => {
    return http({
        url: `/hongyun-training/hazardReport/delete/${id}`,
        method: 'DELETE'
    })
}

/*****************************隐患处理 *********************************************************/
//隐患处理获取列表数据
export const getHandle = (data) => {
    return http({
        url: '/hongyun-training/hazardHandle/list',
        method: 'POST',
        data
    })
}
//隐患处理表单提交
export const operateHandle = (data) => {
    return http({
        url: '/hongyun-training/hazardHandle/insertOrUpdate',
        method: 'POST',
        data
    })
}
//删除隐患处理信息
export const delHandle = (data) => {
    return http({
        url: `/hongyun-training/hazardHandle/delete`,
        method: 'DELETE',
        data
    })
}
//删除隐患处理信息
export const delHandleById = (id) => {
    return http({
        url: `/hongyun-training/hazardReport/delete/${id}`,
        method: 'DELETE'
    })
}


/*****************************隐患整改 *********************************************************/
//整改获取列表数据
export const getRectfication = (data) => {
    return http({
        url: '/hongyun-training/hazardRectification/list',
        method: 'POST',
        data
    })
}
//整改表单提交
export const operateRectfication = (data) => {
    return http({
        url: '/hongyun-training/hazardRectification/insert',
        method: 'POST',
        data
    })
}
//删除整改信息
export const delRectfication = (data) => {
    return http({
        url: `/hongyun-training/hazardRectification/delete`,
        method: 'DELETE',
        data
    })
}
//删除整改信息
export const delRectficationById = (id) => {
    return http({
        url: `/hongyun-training/hazardRectification/delete/${id}`,
        method: 'DELETE'
    })
}

/*****************************隐患复查 *********************************************************/
//复查获取列表数据
export const getReview = (data) => {
    return http({
        url: '/hongyun-training/hazardReview/list',
        method: 'POST',
        data
    })
}
//复查表单提交
export const operateReview = (data) => {
    return http({
        url: '/hongyun-training/hazardReview/insert',
        method: 'POST',
        data
    })
}
//删除复查信息
export const delReview = (data) => {
    return http({
        url: `/hongyun-training/hazardReview/delete`,
        method: 'DELETE',
        data
    })
}
//删除复查信息
export const delReviewById = (id) => {
    return http({
        url: `/hongyun-training/hazardReview/delete/${id}`,
        method: 'DELETE'
    })
}
//编辑时查看数据
export const backRescueInfo = (id) => {
    return http({
        url: '/hongyun-training/rescue/backRescueInfo?id='+id,
        method: 'GET',
    })
}

/***************************************************保养规则************************************************************* */
export const getMaintenanceRulesList = (keyword,dropdownFilter,page,size) => {
    return http({
        url: '/hongyun-training/maintenanceRule/list?keyword='+keyword+'&dropdownFilter='+dropdownFilter+'&page='+page+'&size='+size,
        method: 'GET',
    })
}

export const addMaintenanceRule = (data) => {
    return http({
        url: '/hongyun-training/maintenanceRule',
        method: 'POST',
        data
    })
}

export const delMaintenanceRule = (id) => {
    return http({
        url: `/hongyun-training/maintenanceRule/${id}`,
        method: 'DELETE',
    })
}

export const updateMaintenanceRule = (id,data) => {
    return http({
        url: `/hongyun-training/maintenanceRule/${id}`,
        method: 'PUT',
        data
    })
}
 //获取所有保养规则名称

export const maintenanceRule = () => {
    return http({
        url: '/hongyun-training/maintenanceRule',
        method: 'GET',
    })
}
/***************************************************保养项目************************************************************* */
//获取列表数据
export const getMaintenanceProject = (data) => {
    return http({
        url: '/hongyun-training/maintenance/project/list',
        method: 'POST',
        data
    })
}
//表单提交
export const operateMaintenanceProject = (data) => {
    return http({
        url: '/hongyun-training/maintenance/project/insertOrUpdate',
        method: 'POST',
        data
    })
}
export const getMaintenanceProjectCode = (data) => {
    return http({
        url: '/hongyun-training/maintenance/project/code',
        method: 'POST',
        data
    })
}
//删除
export const delMaintenanceProjectById = (id) => {
    return http({
        url: `/hongyun-training/maintenance/project/delete/${id}`,
        method: 'DELETE',
    })
}
/***************************************************职业健康************************************************************* */

//获取列表数据
export const getOccupationalPage = (data) => {
    return http({
        url: '/hongyun-training/course/getOccupationalPage',
        method: 'POST',
        data
    })
}
export const getOccupationalInfo = (id) => {
    return http({
        url: `/hongyun-training/course/getOccupationalInfo/${id}`,
        method: 'GET'
    })
}
//表单提交
export const operateOccupational = (data) => {
    return http({
        url: '/hongyun-training/course/operateOccupational',
        method: 'POST',
        data
    })
}
//删除
export const delOccupational = (id) => {
    return http({
        url: '/hongyun-training/course/delOccupational?id='+id,
        method: 'DELETE',
    })
}
/***************************************************能耗统计************************************************************* */
/*************************用水记录************************************/
//获取数据
export const energyconsumptionwater = (data,current,size) => {
    return http({
        url: '/hongyun-training/energyconsumptionwater/list?current='+current+'&size='+size,
        method: 'POST',
        data
    })
}
//表单提交
export const energyconsumptionwatersubmit = (data) => {
    return http({
        url: '/hongyun-training/energyconsumptionwater/submit',
        method: 'POST',
        data
    })
}
//删除
export const energyconsumptionwaterremove = (id) => {
    return http({
        url: '/hongyun-training/energyconsumptionwater/remove?ids='+id,
        method: 'POST',
    })
}
/*************************用电记录************************************/
//获取数据
export const energyconsumptionelectric = (data,current,size) => {
    return http({
        url: '/hongyun-training/energyconsumptionelectric/list?current='+current+'&size='+size,
        method: 'POST',
        data
    })
}
//表单提交
export const energyconsumptionelectricsubmit = (data) => {
    return http({
        url: '/hongyun-training/energyconsumptionelectric/submit',
        method: 'POST',
        data
    })
}
//删除
export const energyconsumptionelectricremove = (id) => {
    return http({
        url: '/hongyun-training/energyconsumptionelectric/remove?ids='+id,
        method: 'POST',
    })
}
/*************************氮气统计************************************/
//获取数据
export const energyconsumptionnitrogen = (data,current,size) => {
    return http({
        url: '/hongyun-training/energyconsumptionnitrogen/list?current='+current+'&size='+size,
        method: 'POST',
        data
    })
}
//表单提交
export const energyconsumptionnitrogensubmit = (data) => {
    return http({
        url: '/hongyun-training/energyconsumptionnitrogen/submit',
        method: 'POST',
        data
    })
}
//删除
export const energyconsumptionnitrogenremove = (id) => {
    return http({
        url: '/hongyun-training/energyconsumptionnitrogen/remove?ids='+id,
        method: 'POST',
    })
}